package com.miaow;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author HWZ
 * @date 2023年12月14日 17:08
 * @description
 */
@RestController
@RequestMapping("/api")
public class UploadController {

    @Autowired
    private FileServiceClient fileServiceClient;

    @GetMapping("/")
    public String index() {
        return "upload.html";
    }

    @RequestMapping("/upload")
    public void uploadFile(@RequestPart( value = "file") MultipartFile file) {
        fileServiceClient.uploadFile(file);
    }
}

